Skip to content

feat: add GitHub Copilot API as LLM provider#89

Open
YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
YihanJIANG-lab:feat/copilot-api-provider
Open

feat: add GitHub Copilot API as LLM provider#89
YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
YihanJIANG-lab:feat/copilot-api-provider

Conversation

@YihanJIANG-lab
Copy link
Copy Markdown

Adds support for using GitHub Copilot's chat completions API as a backend provider, enabling use of GPT-4o, Claude, and other models available through Copilot without requiring separate API keys.

Key changes:

  • copilot_auth.py: OAuth token → JWT exchange for Copilot API authentication
  • copilot_config.yaml: Example configuration for Copilot provider
  • Auto-detects Copilot mode via COPILOT_OAUTH_TOKEN environment variable
  • Rate limiting (3s minimum interval between requests)
  • Claude compatibility: explicit max_tokens, multi-choice response handling
  • PermissionDeniedError added to retry exceptions (some APIs return 403 on quota exhaustion)
  • Guard against None token counts in token tracker

Add support for using GitHub Copilot's chat completions API as a backend
provider, enabling use of models available through Copilot (GPT-4o,
Claude, etc.) without requiring separate API keys.

Changes:
- Add copilot_auth.py: OAuth token to JWT exchange for Copilot API
- Add copilot_config.yaml: example configuration for Copilot provider
- backend_openai.py: Copilot client creation, rate limiting (3s min
  interval), Claude compatibility (max_tokens, multi-choice handling)
- backend/__init__.py: auto-detect Copilot mode via COPILOT_OAUTH_TOKEN
- backend_anthropic.py: pass through to OpenAI backend in Copilot mode
- llm.py / vlm.py: Copilot client creation support
- token_tracker.py: guard against None token counts
- backend/utils.py: PermissionDeniedError in retry exceptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant